const utilService = require('../../utilService.js')
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    flag: true,
    redPacketData: null,
  },

  /**
   * 组件的方法列表
   */
  methods: {
    catchtouchmove: function(e) {},
    // 拆红包
    openPacket: function (e) {
      var that = this
      var jsonData = JSON.stringify(this.data.redPacketData)
      wx.navigateTo({
        url: '/redPacket/pages/openPacket/openPacket?data=' + jsonData,
        success: function () {
          that.hide()
        }
      })
    },
    // 关闭弹窗
    closeView: function (e) {
      console.log("点击了关闭！")
    },
    // 显示
    show: function () {
      this.setData({ flag: false })
    },
    // 隐藏
    hide: function () {
      this.setData({ flag: true })
    },
    check: function () {
      var that = this
      utilService.getRedPacketDetail(
        function (data) {
          that.setData({ redPacketData: data})
          that.show()
        },
        function (error) {

        }
      )
    }
  }

})
